# -*- coding: utf-8 -*-
from taobao_category.utils.utils import parse_url

http_ips_proxy = {}

def get_ips_pool():
    if not http_ips_proxy:
        abs_file=__file__
        index = abs_file.rindex('\\')
        path = abs_file[0:index+1]
        with open(path+'proxies.txt', 'r') as f:
            reader = f.readlines()
            for line in reader:
                if line:
                    line = line.strip()
                    protocol, host, _ = parse_url(line)
                    http_ips_proxy.setdefault(protocol, [])
                    http_ips_proxy[protocol].append(line)
            f.close()
    return http_ips_proxy